package com.googlecode.monitoring.model;


public class Person {
	private String fname;
	private String sname;
	private String email;

	public Person(
		String fname,
		String sname,
		String email
	) {
		this.fname = fname;
		this.sname = sname;
		this.email = email;
	}

	public String getFname() {
		return fname;
	}

	public String getSname() {
		return sname;
	}

	public String getEmail() {
		return email;
	}

	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder();
		sb.append("Person");
		sb.append("{fname='").append(fname).append('\'');
		sb.append(", sname='").append(sname).append('\'');
		sb.append(", email='").append(email).append('\'');
		sb.append('}');
		return sb.toString();
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Person)) {
			return false;
		}

		Person person = (Person) o;

		if (email != null ? !email.equals(person.email) : person.email != null) {
			return false;
		}
		if (fname != null ? !fname.equals(person.fname) : person.fname != null) {
			return false;
		}
		if (sname != null ? !sname.equals(person.sname) : person.sname != null) {
			return false;
		}

		return true;
	}

	@Override
	public int hashCode() {
		int result = fname != null ? fname.hashCode() : 0;
		result = 31 * result + (sname != null ? sname.hashCode() : 0);
		result = 31 * result + (email != null ? email.hashCode() : 0);
		return result;
	}
}
